
import {
  formatDate
} from './utils'
const dateServer = value => {
  return value.replace(/(\d{4})(\d{2})(\d{2})/g, '$1-$2-$3')
}
const ymdTime = val => {
  return formatDate(val, 'yyyy-MM-dd')
}
const ymdhmsTime = val => {
  return formatDate(val, 'yyyy-MM-dd hh:mm:ss')
}
const auditFilter = val => {
  let txt = ''
  if (val == 1) {
    txt = '未提交'
  } else if (val == 2) {
    txt = '已提交'
  } else if (val == 3) {
    txt = '审核未通过'
  } else if (val == 4) {
    txt = '审核通过'
  }
  return txt
}

const auditFilt = val => {
  let txt = ''
  if (val == 1) {
    txt = 'info'
  } else if (val == 2) {
    txt = 'warning'
  } else if (val == 3) {
    txt = 'danger'
  } else if (val == 4) {
    txt = 'success'
  }
  return txt
}

const contentType = val => {
  return val == 1 ? '知识点' : val == 2 ? '专题' : '模拟'
}
const levelFilt = val => {
  return val == 1 ? '容易' : val == 2 ? '较易' : val == 3 ? '一般' : val == 4 ? '较难' : val == 5 ? '困难' : ''
}

const stageFilt = val => {
  return val == 100 ? '小学' : val == 200 ? '初中' : val == 300 ? '高中' : ''
}

const natureFilt = val => {
  return val == 1 ? '预习' : val == 2 ? '复习' : ''
}
const learnTypeFilt = val => {
  return val == 1 ? '一对一' : val == 2 ? '班课' : '题目讲解课'
}

const genderFilt = val => {
  return val == 1 ? '男' : val == 0 ? '女' : ''
}
const auditStatusFilt = val => {
  // 审核状态:0=default-无需审核 1=pending-approve待审核 10=first_approved-初审通过，待编辑 11=first_rejected-初审拒绝 20=admin_edited-后台已编辑
  // 30=second_approved-终审通过 31=second_rejected-终审拒绝
  return val == 0 ? '无需审核 ' : val == 1 ? '待审核' : val == 10 ? '初审通过，待编辑' : val == 11 ? '初审拒绝' : val == 20 ? '后台已编辑' : val == 30 ? '终审通过'
    : val == 31 ? '终审拒绝' : ''
}

export { dateServer, ymdTime, ymdhmsTime, auditFilter, auditFilt, stageFilt, contentType, levelFilt, natureFilt, learnTypeFilt, genderFilt, auditStatusFilt }
